﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HNQXYJ.Model;
using HNQXYJ.BLL;
namespace HNQXYJ.HN_AreaGroup
{
    public partial class AreaGroupUpdateById : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(Request["id"]);
            if (!IsPostBack)
            {
                AreaGroup ag = new AreaGroupBLL().GetDataById(id);
                this.txtGroupName.Text = ag.Name;
                this.txtNotes.Text = ag.Notes;
            }
        }

        protected void reset_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("AreaGroupMgr.aspx");
        }

        protected void add_Click(object sender, ImageClickEventArgs e)
        {
            int id = Convert.ToInt32(Request["id"]);
            AreaGroup ag = new AreaGroup();
            ag.ID = id;
            ag.Name = this.txtGroupName.Text;
            ag.Notes = this.txtNotes.Text;

            int res = new AreaGroupBLL().UpdateById(ag);
            if (res > 0)
            {
                Response.Redirect("AreaGroupMgr.aspx");
            }
        }
    }
}